<?php
/**
 * 专题
 * User: E 房cms www.fangcms.com
 * Date: 2015/1/20
 * Time: 10:51
 */
namespace Home\Controller;
use Org\Util\Page;
class SpecialController extends CommonController{
    public function _initialize(){
        parent::_initialize();
    }

    public function index(){
        $where = array('status'=>1,'img'=>array('neq',''));
        $count = M('special')->where($where)->count();
        $pager = new Page($count, 15);
        $this->list = M('special')->where($where)->limit($pager->firstRow.','.$pager->listRows)->order('ordid desc,id desc')->select();
        $this->page = $pager->show();
        $this->display();
    }

    //详细
    public function detail(){
        $id = intval($_GET['id']);
        if(!$id){
            $this->error('没有找到对应ID信息');
        }
        $info = M('special')->where(array('id'=>$id,'status'=>1))->find();
        if(!$info['id']){
            $this->error('没有找到对应ID信息');
        }
        $tpl = 'detail';
        if($info['is_page']){
            $tpl = 'page';
        }
        $this->info = $info;
        $this->seoKey($info,'title');
        $this->display($tpl);
    }



}